package dome3;

/**
 * Created with IntelliJ IDEA.
 * Description: 泛型代码测试
 * User: 王圆豪
 * Date: 2024-07-07
 * Time: 14:54
 */

class Alag<E extends Comparable<E>>{
    public E findMax(E[] array){
        E max = array[0];
        for (int i = 1; i < array.length; i++) {
            if (max.compareTo(array[i]) < 0) {
                max = array[i];
            }
        }
        return max;
    }
}

public class Test {
    public static void main(String[] args) {
        Alag<Integer> alag = new Alag<>();
        Integer[] array = new Integer[]{1, 55, 41, 32};
        alag.findMax(array);
    }
}
